#! /usr/bin/env python
#
# Copyright 2008 Spencer Davis <SpencerDavis91@gmail.com>
#
# Recuerde is a simple list manager.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://gnu.org/licenses/.>
#

import wx
from database import Database
from mainwindow import MainWindow
from dbusinterface import RecuerdeDBus
from dbus.mainloop.glib import DBusGMainLoop
from trayicon import TrayIcon

class Recuerde:
    """A list manager."""
    def __init__(self):
        """Initialize application."""
        # Create a connection to the database
        self.db = Database()

        # Create wx application
        app = wx.PySimpleApp()

        # Create the main window
        self.mainWindow = MainWindow(self.db, None, wx.ID_ANY, 'Recuerde')

        # Start DBus interface
        DBusGMainLoop(set_as_default=True)
        self.dbus = RecuerdeDBus('/Recuerde')

        # Create tray icon
        tbicon = TrayIcon(self.mainWindow)

        # Run event loop
        app.MainLoop()

# If the program is not being imported, run it
if __name__ == '__main__':
    recuerde = Recuerde()
